package com.steven.im.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.squareup.picasso.Picasso;
import com.steven.im.App;
import com.steven.im.R;
import com.steven.im.entity.BidRecordEntity;

import java.util.List;

/**
 * Created by Steven on 2019/2/15.
 */
public class BidRecordAdapter extends BaseQuickAdapter<BidRecordEntity, BaseViewHolder> {
    private Context mContext;

    public BidRecordAdapter(Context mContext, @Nullable List<BidRecordEntity> data) {
        super(R.layout.bidrecord_item, data);
        this.mContext = mContext;
    }

    @Override
    protected void convert(BaseViewHolder helper, BidRecordEntity item) {
        helper.getView(R.id.ll_).setBackgroundColor(mContext.getResources().getColor(R.color.white));
        Picasso.with(App.getContext()).load(item.getUrl()).into(((ImageView) helper.getView(R.id.iv_people)));
        if (helper.getPosition() == 0) {
            ((TextView) helper.getView(R.id.tv_status)).setText("领先");
            ((TextView) helper.getView(R.id.tv_phone)).setTextColor(mContext.getResources().getColor(R.color.mainBg));
            ((TextView) helper.getView(R.id.tv_address)).setTextColor(mContext.getResources().getColor(R.color.mainBg));
            ((TextView) helper.getView(R.id.tv_money)).setTextColor(mContext.getResources().getColor(R.color.mainBg));
            ((TextView) helper.getView(R.id.tv_status)).setTextColor(mContext.getResources().getColor(R.color.mainBg));
        } else {
            ((TextView) helper.getView(R.id.tv_status)).setText("出局");
            ((TextView) helper.getView(R.id.tv_phone)).setTextColor(mContext.getResources().getColor(R.color.color666));
            ((TextView) helper.getView(R.id.tv_address)).setTextColor(mContext.getResources().getColor(R.color.color666));
            ((TextView) helper.getView(R.id.tv_money)).setTextColor(mContext.getResources().getColor(R.color.color666));
            ((TextView) helper.getView(R.id.tv_status)).setTextColor(mContext.getResources().getColor(R.color.color666));
        }
        ((TextView) helper.getView(R.id.tv_phone)).setText(item.getPhone());
        ((TextView) helper.getView(R.id.tv_address)).setText(item.getAddress());
        ((TextView) helper.getView(R.id.tv_money)).setText(item.getMoney());
    }
}
